<?php include_once "usuariosinfo.php" ?>
<?php

// Create page object
if (!isset($submenu_grid)) $submenu_grid = new csubmenu_grid();

// Page init
$submenu_grid->Page_Init();

// Page main
$submenu_grid->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$submenu_grid->Page_Render();
?>
<?php if ($submenu->Export == "") { ?>
<script type="text/javascript">

// Page object
var submenu_grid = new ew_Page("submenu_grid");
submenu_grid.PageID = "grid"; // Page ID
var EW_PAGE_ID = submenu_grid.PageID; // For backward compatibility

// Form object
var fsubmenugrid = new ew_Form("fsubmenugrid");
fsubmenugrid.FormKeyCountName = '<?php echo $submenu_grid->FormKeyCountName ?>';

// Validate form
fsubmenugrid.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
		var checkrow = (gridinsert) ? !this.EmptyRow(infix) : true;
		if (checkrow) {
			addcnt++;
			elm = this.GetElements("x" + infix + "__Menu");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($submenu->_Menu->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_Orden");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($submenu->Orden->FldErrMsg()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
		} // End Grid Add checking
	}
	return true;
}

// Check empty row
fsubmenugrid.EmptyRow = function(infix) {
	var fobj = this.Form;
	if (ew_ValueChanged(fobj, infix, "_Menu", false)) return false;
	if (ew_ValueChanged(fobj, infix, "Titulo", false)) return false;
	if (ew_ValueChanged(fobj, infix, "Destino", false)) return false;
	if (ew_ValueChanged(fobj, infix, "Url", false)) return false;
	if (ew_ValueChanged(fobj, infix, "Orden", false)) return false;
	return true;
}

// Form_CustomValidate event
fsubmenugrid.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fsubmenugrid.ValidateRequired = true;
<?php } else { ?>
fsubmenugrid.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
// Form object for search

</script>
<?php } ?>
<?php if ($submenu->getCurrentMasterTable() == "" && $submenu_grid->ExportOptions->Visible()) { ?>
<div class="ewListExportOptions"><?php $submenu_grid->ExportOptions->Render("body") ?></div>
<?php } ?>
<?php
if ($submenu->CurrentAction == "gridadd") {
	if ($submenu->CurrentMode == "copy") {
		$bSelectLimit = EW_SELECT_LIMIT;
		if ($bSelectLimit) {
			$submenu_grid->TotalRecs = $submenu->SelectRecordCount();
			$submenu_grid->Recordset = $submenu_grid->LoadRecordset($submenu_grid->StartRec-1, $submenu_grid->DisplayRecs);
		} else {
			if ($submenu_grid->Recordset = $submenu_grid->LoadRecordset())
				$submenu_grid->TotalRecs = $submenu_grid->Recordset->RecordCount();
		}
		$submenu_grid->StartRec = 1;
		$submenu_grid->DisplayRecs = $submenu_grid->TotalRecs;
	} else {
		$submenu->CurrentFilter = "0=1";
		$submenu_grid->StartRec = 1;
		$submenu_grid->DisplayRecs = $submenu->GridAddRowCount;
	}
	$submenu_grid->TotalRecs = $submenu_grid->DisplayRecs;
	$submenu_grid->StopRec = $submenu_grid->DisplayRecs;
} else {
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$submenu_grid->TotalRecs = $submenu->SelectRecordCount();
	} else {
		if ($submenu_grid->Recordset = $submenu_grid->LoadRecordset())
			$submenu_grid->TotalRecs = $submenu_grid->Recordset->RecordCount();
	}
	$submenu_grid->StartRec = 1;
	$submenu_grid->DisplayRecs = $submenu_grid->TotalRecs; // Display all records
	if ($bSelectLimit)
		$submenu_grid->Recordset = $submenu_grid->LoadRecordset($submenu_grid->StartRec-1, $submenu_grid->DisplayRecs);
}
$submenu_grid->RenderOtherOptions();
?>
<?php $submenu_grid->ShowPageHeader(); ?>
<?php
$submenu_grid->ShowMessage();
?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div id="fsubmenugrid" class="ewForm form-horizontal">
<div id="gmp_submenu" class="ewGridMiddlePanel">
<table id="tbl_submenugrid" class="ewTable ewTableSeparate">
<?php echo $submenu->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$submenu_grid->RenderListOptions();

// Render list options (header, left)
$submenu_grid->ListOptions->Render("header", "left");
?>
<?php if ($submenu->id->Visible) { // id ?>
	<?php if ($submenu->SortUrl($submenu->id) == "") { ?>
		<td><div id="elh_submenu_id" class="submenu_id"><div class="ewTableHeaderCaption"><?php echo $submenu->id->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_submenu_id" class="submenu_id">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $submenu->id->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($submenu->id->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($submenu->id->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($submenu->_Menu->Visible) { // Menu ?>
	<?php if ($submenu->SortUrl($submenu->_Menu) == "") { ?>
		<td><div id="elh_submenu__Menu" class="submenu__Menu"><div class="ewTableHeaderCaption"><?php echo $submenu->_Menu->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_submenu__Menu" class="submenu__Menu">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $submenu->_Menu->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($submenu->_Menu->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($submenu->_Menu->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($submenu->Titulo->Visible) { // Titulo ?>
	<?php if ($submenu->SortUrl($submenu->Titulo) == "") { ?>
		<td><div id="elh_submenu_Titulo" class="submenu_Titulo"><div class="ewTableHeaderCaption"><?php echo $submenu->Titulo->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_submenu_Titulo" class="submenu_Titulo">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $submenu->Titulo->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($submenu->Titulo->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($submenu->Titulo->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($submenu->Destino->Visible) { // Destino ?>
	<?php if ($submenu->SortUrl($submenu->Destino) == "") { ?>
		<td><div id="elh_submenu_Destino" class="submenu_Destino"><div class="ewTableHeaderCaption"><?php echo $submenu->Destino->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_submenu_Destino" class="submenu_Destino">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $submenu->Destino->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($submenu->Destino->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($submenu->Destino->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($submenu->Url->Visible) { // Url ?>
	<?php if ($submenu->SortUrl($submenu->Url) == "") { ?>
		<td><div id="elh_submenu_Url" class="submenu_Url"><div class="ewTableHeaderCaption"><?php echo $submenu->Url->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_submenu_Url" class="submenu_Url">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $submenu->Url->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($submenu->Url->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($submenu->Url->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($submenu->Orden->Visible) { // Orden ?>
	<?php if ($submenu->SortUrl($submenu->Orden) == "") { ?>
		<td><div id="elh_submenu_Orden" class="submenu_Orden"><div class="ewTableHeaderCaption"><?php echo $submenu->Orden->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_submenu_Orden" class="submenu_Orden">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $submenu->Orden->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($submenu->Orden->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($submenu->Orden->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$submenu_grid->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
$submenu_grid->StartRec = 1;
$submenu_grid->StopRec = $submenu_grid->TotalRecs; // Show all records

// Restore number of post back records
if ($objForm) {
	$objForm->Index = -1;
	if ($objForm->HasValue($submenu_grid->FormKeyCountName) && ($submenu->CurrentAction == "gridadd" || $submenu->CurrentAction == "gridedit" || $submenu->CurrentAction == "F")) {
		$submenu_grid->KeyCount = $objForm->GetValue($submenu_grid->FormKeyCountName);
		$submenu_grid->StopRec = $submenu_grid->StartRec + $submenu_grid->KeyCount - 1;
	}
}
$submenu_grid->RecCnt = $submenu_grid->StartRec - 1;
if ($submenu_grid->Recordset && !$submenu_grid->Recordset->EOF) {
	$submenu_grid->Recordset->MoveFirst();
	if (!$bSelectLimit && $submenu_grid->StartRec > 1)
		$submenu_grid->Recordset->Move($submenu_grid->StartRec - 1);
} elseif (!$submenu->AllowAddDeleteRow && $submenu_grid->StopRec == 0) {
	$submenu_grid->StopRec = $submenu->GridAddRowCount;
}

// Initialize aggregate
$submenu->RowType = EW_ROWTYPE_AGGREGATEINIT;
$submenu->ResetAttrs();
$submenu_grid->RenderRow();
if ($submenu->CurrentAction == "gridadd")
	$submenu_grid->RowIndex = 0;
if ($submenu->CurrentAction == "gridedit")
	$submenu_grid->RowIndex = 0;
while ($submenu_grid->RecCnt < $submenu_grid->StopRec) {
	$submenu_grid->RecCnt++;
	if (intval($submenu_grid->RecCnt) >= intval($submenu_grid->StartRec)) {
		$submenu_grid->RowCnt++;
		if ($submenu->CurrentAction == "gridadd" || $submenu->CurrentAction == "gridedit" || $submenu->CurrentAction == "F") {
			$submenu_grid->RowIndex++;
			$objForm->Index = $submenu_grid->RowIndex;
			if ($objForm->HasValue($submenu_grid->FormActionName))
				$submenu_grid->RowAction = strval($objForm->GetValue($submenu_grid->FormActionName));
			elseif ($submenu->CurrentAction == "gridadd")
				$submenu_grid->RowAction = "insert";
			else
				$submenu_grid->RowAction = "";
		}

		// Set up key count
		$submenu_grid->KeyCount = $submenu_grid->RowIndex;

		// Init row class and style
		$submenu->ResetAttrs();
		$submenu->CssClass = "";
		if ($submenu->CurrentAction == "gridadd") {
			if ($submenu->CurrentMode == "copy") {
				$submenu_grid->LoadRowValues($submenu_grid->Recordset); // Load row values
				$submenu_grid->SetRecordKey($submenu_grid->RowOldKey, $submenu_grid->Recordset); // Set old record key
			} else {
				$submenu_grid->LoadDefaultValues(); // Load default values
				$submenu_grid->RowOldKey = ""; // Clear old key value
			}
		} else {
			$submenu_grid->LoadRowValues($submenu_grid->Recordset); // Load row values
		}
		$submenu->RowType = EW_ROWTYPE_VIEW; // Render view
		if ($submenu->CurrentAction == "gridadd") // Grid add
			$submenu->RowType = EW_ROWTYPE_ADD; // Render add
		if ($submenu->CurrentAction == "gridadd" && $submenu->EventCancelled && !$objForm->HasValue("k_blankrow")) // Insert failed
			$submenu_grid->RestoreCurrentRowFormValues($submenu_grid->RowIndex); // Restore form values
		if ($submenu->CurrentAction == "gridedit") { // Grid edit
			if ($submenu->EventCancelled) {
				$submenu_grid->RestoreCurrentRowFormValues($submenu_grid->RowIndex); // Restore form values
			}
			if ($submenu_grid->RowAction == "insert")
				$submenu->RowType = EW_ROWTYPE_ADD; // Render add
			else
				$submenu->RowType = EW_ROWTYPE_EDIT; // Render edit
		}
		if ($submenu->CurrentAction == "gridedit" && ($submenu->RowType == EW_ROWTYPE_EDIT || $submenu->RowType == EW_ROWTYPE_ADD) && $submenu->EventCancelled) // Update failed
			$submenu_grid->RestoreCurrentRowFormValues($submenu_grid->RowIndex); // Restore form values
		if ($submenu->RowType == EW_ROWTYPE_EDIT) // Edit row
			$submenu_grid->EditRowCnt++;
		if ($submenu->CurrentAction == "F") // Confirm row
			$submenu_grid->RestoreCurrentRowFormValues($submenu_grid->RowIndex); // Restore form values

		// Set up row id / data-rowindex
		$submenu->RowAttrs = array_merge($submenu->RowAttrs, array('data-rowindex'=>$submenu_grid->RowCnt, 'id'=>'r' . $submenu_grid->RowCnt . '_submenu', 'data-rowtype'=>$submenu->RowType));

		// Render row
		$submenu_grid->RenderRow();

		// Render list options
		$submenu_grid->RenderListOptions();

		// Skip delete row / empty row for confirm page
		if ($submenu_grid->RowAction <> "delete" && $submenu_grid->RowAction <> "insertdelete" && !($submenu_grid->RowAction == "insert" && $submenu->CurrentAction == "F" && $submenu_grid->EmptyRow())) {
?>
	<tr<?php echo $submenu->RowAttributes() ?>>
<?php

// Render list options (body, left)
$submenu_grid->ListOptions->Render("body", "left", $submenu_grid->RowCnt);
?>
	<?php if ($submenu->id->Visible) { // id ?>
		<td<?php echo $submenu->id->CellAttributes() ?>>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<input type="hidden" data-field="x_id" name="o<?php echo $submenu_grid->RowIndex ?>_id" id="o<?php echo $submenu_grid->RowIndex ?>_id" value="<?php echo ew_HtmlEncode($submenu->id->OldValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_id" class="control-group submenu_id">
<span<?php echo $submenu->id->ViewAttributes() ?>>
<?php echo $submenu->id->EditValue ?></span>
</span>
<input type="hidden" data-field="x_id" name="x<?php echo $submenu_grid->RowIndex ?>_id" id="x<?php echo $submenu_grid->RowIndex ?>_id" value="<?php echo ew_HtmlEncode($submenu->id->CurrentValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $submenu->id->ViewAttributes() ?>>
<?php echo $submenu->id->ListViewValue() ?></span>
<input type="hidden" data-field="x_id" name="x<?php echo $submenu_grid->RowIndex ?>_id" id="x<?php echo $submenu_grid->RowIndex ?>_id" value="<?php echo ew_HtmlEncode($submenu->id->FormValue) ?>">
<input type="hidden" data-field="x_id" name="o<?php echo $submenu_grid->RowIndex ?>_id" id="o<?php echo $submenu_grid->RowIndex ?>_id" value="<?php echo ew_HtmlEncode($submenu->id->OldValue) ?>">
<?php } ?>
<a id="<?php echo $submenu_grid->PageObjName . "_row_" . $submenu_grid->RowCnt ?>"></a></td>
	<?php } ?>
	<?php if ($submenu->_Menu->Visible) { // Menu ?>
		<td<?php echo $submenu->_Menu->CellAttributes() ?>>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<?php if ($submenu->_Menu->getSessionValue() <> "") { ?>
<span<?php echo $submenu->_Menu->ViewAttributes() ?>>
<?php echo $submenu->_Menu->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->CurrentValue) ?>">
<?php } else { ?>
<input type="text" data-field="x__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" size="30" placeholder="<?php echo $submenu->_Menu->PlaceHolder ?>" value="<?php echo $submenu->_Menu->EditValue ?>"<?php echo $submenu->_Menu->EditAttributes() ?>>
<?php } ?>
<input type="hidden" data-field="x__Menu" name="o<?php echo $submenu_grid->RowIndex ?>__Menu" id="o<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->OldValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<?php if ($submenu->_Menu->getSessionValue() <> "") { ?>
<span<?php echo $submenu->_Menu->ViewAttributes() ?>>
<?php echo $submenu->_Menu->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->CurrentValue) ?>">
<?php } else { ?>
<input type="text" data-field="x__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" size="30" placeholder="<?php echo $submenu->_Menu->PlaceHolder ?>" value="<?php echo $submenu->_Menu->EditValue ?>"<?php echo $submenu->_Menu->EditAttributes() ?>>
<?php } ?>
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $submenu->_Menu->ViewAttributes() ?>>
<?php echo $submenu->_Menu->ListViewValue() ?></span>
<input type="hidden" data-field="x__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->FormValue) ?>">
<input type="hidden" data-field="x__Menu" name="o<?php echo $submenu_grid->RowIndex ?>__Menu" id="o<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($submenu->Titulo->Visible) { // Titulo ?>
		<td<?php echo $submenu->Titulo->CellAttributes() ?>>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Titulo" class="control-group submenu_Titulo">
<input type="text" data-field="x_Titulo" name="x<?php echo $submenu_grid->RowIndex ?>_Titulo" id="x<?php echo $submenu_grid->RowIndex ?>_Titulo" size="30" maxlength="140" placeholder="<?php echo $submenu->Titulo->PlaceHolder ?>" value="<?php echo $submenu->Titulo->EditValue ?>"<?php echo $submenu->Titulo->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_Titulo" name="o<?php echo $submenu_grid->RowIndex ?>_Titulo" id="o<?php echo $submenu_grid->RowIndex ?>_Titulo" value="<?php echo ew_HtmlEncode($submenu->Titulo->OldValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Titulo" class="control-group submenu_Titulo">
<input type="text" data-field="x_Titulo" name="x<?php echo $submenu_grid->RowIndex ?>_Titulo" id="x<?php echo $submenu_grid->RowIndex ?>_Titulo" size="30" maxlength="140" placeholder="<?php echo $submenu->Titulo->PlaceHolder ?>" value="<?php echo $submenu->Titulo->EditValue ?>"<?php echo $submenu->Titulo->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $submenu->Titulo->ViewAttributes() ?>>
<?php echo $submenu->Titulo->ListViewValue() ?></span>
<input type="hidden" data-field="x_Titulo" name="x<?php echo $submenu_grid->RowIndex ?>_Titulo" id="x<?php echo $submenu_grid->RowIndex ?>_Titulo" value="<?php echo ew_HtmlEncode($submenu->Titulo->FormValue) ?>">
<input type="hidden" data-field="x_Titulo" name="o<?php echo $submenu_grid->RowIndex ?>_Titulo" id="o<?php echo $submenu_grid->RowIndex ?>_Titulo" value="<?php echo ew_HtmlEncode($submenu->Titulo->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($submenu->Destino->Visible) { // Destino ?>
		<td<?php echo $submenu->Destino->CellAttributes() ?>>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Destino" class="control-group submenu_Destino">
<input type="text" data-field="x_Destino" name="x<?php echo $submenu_grid->RowIndex ?>_Destino" id="x<?php echo $submenu_grid->RowIndex ?>_Destino" size="30" maxlength="20" placeholder="<?php echo $submenu->Destino->PlaceHolder ?>" value="<?php echo $submenu->Destino->EditValue ?>"<?php echo $submenu->Destino->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_Destino" name="o<?php echo $submenu_grid->RowIndex ?>_Destino" id="o<?php echo $submenu_grid->RowIndex ?>_Destino" value="<?php echo ew_HtmlEncode($submenu->Destino->OldValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Destino" class="control-group submenu_Destino">
<input type="text" data-field="x_Destino" name="x<?php echo $submenu_grid->RowIndex ?>_Destino" id="x<?php echo $submenu_grid->RowIndex ?>_Destino" size="30" maxlength="20" placeholder="<?php echo $submenu->Destino->PlaceHolder ?>" value="<?php echo $submenu->Destino->EditValue ?>"<?php echo $submenu->Destino->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $submenu->Destino->ViewAttributes() ?>>
<?php echo $submenu->Destino->ListViewValue() ?></span>
<input type="hidden" data-field="x_Destino" name="x<?php echo $submenu_grid->RowIndex ?>_Destino" id="x<?php echo $submenu_grid->RowIndex ?>_Destino" value="<?php echo ew_HtmlEncode($submenu->Destino->FormValue) ?>">
<input type="hidden" data-field="x_Destino" name="o<?php echo $submenu_grid->RowIndex ?>_Destino" id="o<?php echo $submenu_grid->RowIndex ?>_Destino" value="<?php echo ew_HtmlEncode($submenu->Destino->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($submenu->Url->Visible) { // Url ?>
		<td<?php echo $submenu->Url->CellAttributes() ?>>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Url" class="control-group submenu_Url">
<input type="text" data-field="x_Url" name="x<?php echo $submenu_grid->RowIndex ?>_Url" id="x<?php echo $submenu_grid->RowIndex ?>_Url" size="30" maxlength="200" placeholder="<?php echo $submenu->Url->PlaceHolder ?>" value="<?php echo $submenu->Url->EditValue ?>"<?php echo $submenu->Url->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_Url" name="o<?php echo $submenu_grid->RowIndex ?>_Url" id="o<?php echo $submenu_grid->RowIndex ?>_Url" value="<?php echo ew_HtmlEncode($submenu->Url->OldValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Url" class="control-group submenu_Url">
<input type="text" data-field="x_Url" name="x<?php echo $submenu_grid->RowIndex ?>_Url" id="x<?php echo $submenu_grid->RowIndex ?>_Url" size="30" maxlength="200" placeholder="<?php echo $submenu->Url->PlaceHolder ?>" value="<?php echo $submenu->Url->EditValue ?>"<?php echo $submenu->Url->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $submenu->Url->ViewAttributes() ?>>
<?php echo $submenu->Url->ListViewValue() ?></span>
<input type="hidden" data-field="x_Url" name="x<?php echo $submenu_grid->RowIndex ?>_Url" id="x<?php echo $submenu_grid->RowIndex ?>_Url" value="<?php echo ew_HtmlEncode($submenu->Url->FormValue) ?>">
<input type="hidden" data-field="x_Url" name="o<?php echo $submenu_grid->RowIndex ?>_Url" id="o<?php echo $submenu_grid->RowIndex ?>_Url" value="<?php echo ew_HtmlEncode($submenu->Url->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($submenu->Orden->Visible) { // Orden ?>
		<td<?php echo $submenu->Orden->CellAttributes() ?>>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Orden" class="control-group submenu_Orden">
<input type="text" data-field="x_Orden" name="x<?php echo $submenu_grid->RowIndex ?>_Orden" id="x<?php echo $submenu_grid->RowIndex ?>_Orden" size="30" placeholder="<?php echo $submenu->Orden->PlaceHolder ?>" value="<?php echo $submenu->Orden->EditValue ?>"<?php echo $submenu->Orden->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_Orden" name="o<?php echo $submenu_grid->RowIndex ?>_Orden" id="o<?php echo $submenu_grid->RowIndex ?>_Orden" value="<?php echo ew_HtmlEncode($submenu->Orden->OldValue) ?>">
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $submenu_grid->RowCnt ?>_submenu_Orden" class="control-group submenu_Orden">
<input type="text" data-field="x_Orden" name="x<?php echo $submenu_grid->RowIndex ?>_Orden" id="x<?php echo $submenu_grid->RowIndex ?>_Orden" size="30" placeholder="<?php echo $submenu->Orden->PlaceHolder ?>" value="<?php echo $submenu->Orden->EditValue ?>"<?php echo $submenu->Orden->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($submenu->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $submenu->Orden->ViewAttributes() ?>>
<?php echo $submenu->Orden->ListViewValue() ?></span>
<input type="hidden" data-field="x_Orden" name="x<?php echo $submenu_grid->RowIndex ?>_Orden" id="x<?php echo $submenu_grid->RowIndex ?>_Orden" value="<?php echo ew_HtmlEncode($submenu->Orden->FormValue) ?>">
<input type="hidden" data-field="x_Orden" name="o<?php echo $submenu_grid->RowIndex ?>_Orden" id="o<?php echo $submenu_grid->RowIndex ?>_Orden" value="<?php echo ew_HtmlEncode($submenu->Orden->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$submenu_grid->ListOptions->Render("body", "right", $submenu_grid->RowCnt);
?>
	</tr>
<?php if ($submenu->RowType == EW_ROWTYPE_ADD || $submenu->RowType == EW_ROWTYPE_EDIT) { ?>
<script type="text/javascript">
fsubmenugrid.UpdateOpts(<?php echo $submenu_grid->RowIndex ?>);
</script>
<?php } ?>
<?php
	}
	} // End delete row checking
	if ($submenu->CurrentAction <> "gridadd" || $submenu->CurrentMode == "copy")
		if (!$submenu_grid->Recordset->EOF) $submenu_grid->Recordset->MoveNext();
}
?>
<?php
	if ($submenu->CurrentMode == "add" || $submenu->CurrentMode == "copy" || $submenu->CurrentMode == "edit") {
		$submenu_grid->RowIndex = '$rowindex$';
		$submenu_grid->LoadDefaultValues();

		// Set row properties
		$submenu->ResetAttrs();
		$submenu->RowAttrs = array_merge($submenu->RowAttrs, array('data-rowindex'=>$submenu_grid->RowIndex, 'id'=>'r0_submenu', 'data-rowtype'=>EW_ROWTYPE_ADD));
		ew_AppendClass($submenu->RowAttrs["class"], "ewTemplate");
		$submenu->RowType = EW_ROWTYPE_ADD;

		// Render row
		$submenu_grid->RenderRow();

		// Render list options
		$submenu_grid->RenderListOptions();
		$submenu_grid->StartRowCnt = 0;
?>
	<tr<?php echo $submenu->RowAttributes() ?>>
<?php

// Render list options (body, left)
$submenu_grid->ListOptions->Render("body", "left", $submenu_grid->RowIndex);
?>
	<?php if ($submenu->id->Visible) { // id ?>
		<td>
<?php if ($submenu->CurrentAction <> "F") { ?>
<?php } else { ?>
<span id="el$rowindex$_submenu_id" class="control-group submenu_id">
<span<?php echo $submenu->id->ViewAttributes() ?>>
<?php echo $submenu->id->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_id" name="x<?php echo $submenu_grid->RowIndex ?>_id" id="x<?php echo $submenu_grid->RowIndex ?>_id" value="<?php echo ew_HtmlEncode($submenu->id->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_id" name="o<?php echo $submenu_grid->RowIndex ?>_id" id="o<?php echo $submenu_grid->RowIndex ?>_id" value="<?php echo ew_HtmlEncode($submenu->id->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($submenu->_Menu->Visible) { // Menu ?>
		<td>
<?php if ($submenu->CurrentAction <> "F") { ?>
<?php if ($submenu->_Menu->getSessionValue() <> "") { ?>
<span<?php echo $submenu->_Menu->ViewAttributes() ?>>
<?php echo $submenu->_Menu->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->CurrentValue) ?>">
<?php } else { ?>
<input type="text" data-field="x__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" size="30" placeholder="<?php echo $submenu->_Menu->PlaceHolder ?>" value="<?php echo $submenu->_Menu->EditValue ?>"<?php echo $submenu->_Menu->EditAttributes() ?>>
<?php } ?>
<?php } else { ?>
<span<?php echo $submenu->_Menu->ViewAttributes() ?>>
<?php echo $submenu->_Menu->ViewValue ?></span>
<input type="hidden" data-field="x__Menu" name="x<?php echo $submenu_grid->RowIndex ?>__Menu" id="x<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x__Menu" name="o<?php echo $submenu_grid->RowIndex ?>__Menu" id="o<?php echo $submenu_grid->RowIndex ?>__Menu" value="<?php echo ew_HtmlEncode($submenu->_Menu->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($submenu->Titulo->Visible) { // Titulo ?>
		<td>
<?php if ($submenu->CurrentAction <> "F") { ?>
<span id="el$rowindex$_submenu_Titulo" class="control-group submenu_Titulo">
<input type="text" data-field="x_Titulo" name="x<?php echo $submenu_grid->RowIndex ?>_Titulo" id="x<?php echo $submenu_grid->RowIndex ?>_Titulo" size="30" maxlength="140" placeholder="<?php echo $submenu->Titulo->PlaceHolder ?>" value="<?php echo $submenu->Titulo->EditValue ?>"<?php echo $submenu->Titulo->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_submenu_Titulo" class="control-group submenu_Titulo">
<span<?php echo $submenu->Titulo->ViewAttributes() ?>>
<?php echo $submenu->Titulo->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_Titulo" name="x<?php echo $submenu_grid->RowIndex ?>_Titulo" id="x<?php echo $submenu_grid->RowIndex ?>_Titulo" value="<?php echo ew_HtmlEncode($submenu->Titulo->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_Titulo" name="o<?php echo $submenu_grid->RowIndex ?>_Titulo" id="o<?php echo $submenu_grid->RowIndex ?>_Titulo" value="<?php echo ew_HtmlEncode($submenu->Titulo->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($submenu->Destino->Visible) { // Destino ?>
		<td>
<?php if ($submenu->CurrentAction <> "F") { ?>
<span id="el$rowindex$_submenu_Destino" class="control-group submenu_Destino">
<input type="text" data-field="x_Destino" name="x<?php echo $submenu_grid->RowIndex ?>_Destino" id="x<?php echo $submenu_grid->RowIndex ?>_Destino" size="30" maxlength="20" placeholder="<?php echo $submenu->Destino->PlaceHolder ?>" value="<?php echo $submenu->Destino->EditValue ?>"<?php echo $submenu->Destino->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_submenu_Destino" class="control-group submenu_Destino">
<span<?php echo $submenu->Destino->ViewAttributes() ?>>
<?php echo $submenu->Destino->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_Destino" name="x<?php echo $submenu_grid->RowIndex ?>_Destino" id="x<?php echo $submenu_grid->RowIndex ?>_Destino" value="<?php echo ew_HtmlEncode($submenu->Destino->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_Destino" name="o<?php echo $submenu_grid->RowIndex ?>_Destino" id="o<?php echo $submenu_grid->RowIndex ?>_Destino" value="<?php echo ew_HtmlEncode($submenu->Destino->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($submenu->Url->Visible) { // Url ?>
		<td>
<?php if ($submenu->CurrentAction <> "F") { ?>
<span id="el$rowindex$_submenu_Url" class="control-group submenu_Url">
<input type="text" data-field="x_Url" name="x<?php echo $submenu_grid->RowIndex ?>_Url" id="x<?php echo $submenu_grid->RowIndex ?>_Url" size="30" maxlength="200" placeholder="<?php echo $submenu->Url->PlaceHolder ?>" value="<?php echo $submenu->Url->EditValue ?>"<?php echo $submenu->Url->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_submenu_Url" class="control-group submenu_Url">
<span<?php echo $submenu->Url->ViewAttributes() ?>>
<?php echo $submenu->Url->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_Url" name="x<?php echo $submenu_grid->RowIndex ?>_Url" id="x<?php echo $submenu_grid->RowIndex ?>_Url" value="<?php echo ew_HtmlEncode($submenu->Url->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_Url" name="o<?php echo $submenu_grid->RowIndex ?>_Url" id="o<?php echo $submenu_grid->RowIndex ?>_Url" value="<?php echo ew_HtmlEncode($submenu->Url->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($submenu->Orden->Visible) { // Orden ?>
		<td>
<?php if ($submenu->CurrentAction <> "F") { ?>
<span id="el$rowindex$_submenu_Orden" class="control-group submenu_Orden">
<input type="text" data-field="x_Orden" name="x<?php echo $submenu_grid->RowIndex ?>_Orden" id="x<?php echo $submenu_grid->RowIndex ?>_Orden" size="30" placeholder="<?php echo $submenu->Orden->PlaceHolder ?>" value="<?php echo $submenu->Orden->EditValue ?>"<?php echo $submenu->Orden->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_submenu_Orden" class="control-group submenu_Orden">
<span<?php echo $submenu->Orden->ViewAttributes() ?>>
<?php echo $submenu->Orden->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_Orden" name="x<?php echo $submenu_grid->RowIndex ?>_Orden" id="x<?php echo $submenu_grid->RowIndex ?>_Orden" value="<?php echo ew_HtmlEncode($submenu->Orden->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_Orden" name="o<?php echo $submenu_grid->RowIndex ?>_Orden" id="o<?php echo $submenu_grid->RowIndex ?>_Orden" value="<?php echo ew_HtmlEncode($submenu->Orden->OldValue) ?>">
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$submenu_grid->ListOptions->Render("body", "right", $submenu_grid->RowCnt);
?>
<script type="text/javascript">
fsubmenugrid.UpdateOpts(<?php echo $submenu_grid->RowIndex ?>);
</script>
	</tr>
<?php
}
?>
</tbody>
</table>
<?php if ($submenu->CurrentMode == "add" || $submenu->CurrentMode == "copy") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridinsert">
<input type="hidden" name="<?php echo $submenu_grid->FormKeyCountName ?>" id="<?php echo $submenu_grid->FormKeyCountName ?>" value="<?php echo $submenu_grid->KeyCount ?>">
<?php echo $submenu_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($submenu->CurrentMode == "edit") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridupdate">
<input type="hidden" name="<?php echo $submenu_grid->FormKeyCountName ?>" id="<?php echo $submenu_grid->FormKeyCountName ?>" value="<?php echo $submenu_grid->KeyCount ?>">
<?php echo $submenu_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($submenu->CurrentMode == "") { ?>
<input type="hidden" name="a_list" id="a_list" value="">
<?php } ?>
<input type="hidden" name="detailpage" value="fsubmenugrid">
</div>
<?php

// Close recordset
if ($submenu_grid->Recordset)
	$submenu_grid->Recordset->Close();
?>
<?php if ($submenu_grid->ShowOtherOptions) { ?>
<div class="ewGridLowerPanel ewListOtherOptions">
<?php
	foreach ($submenu_grid->OtherOptions as &$option)
		$option->Render("body", "bottom");
?>
</div>
<?php } ?>
</div>
</td></tr></table>
<?php if ($submenu->Export == "") { ?>
<script type="text/javascript">
fsubmenugrid.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php } ?>
<?php
$submenu_grid->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<?php
$submenu_grid->Page_Terminate();
?>
